﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DoAnOOP.DataAccessLayer;
using System.Data;
namespace DoAnOOP.BussinessLayer
{
    class clsQLGV
    {
        #region Biến cục bộ
        clsConnect _myConnect = new clsConnect();

        public string MaGV { get; set; }
        public string Ho { get; set; }
        public string Ten { get; set; }
        public string GioiTinh { get; set; }
        public string NgaySinh { get; set; }
        public string NoiSinh { get; set; }
        public string MaKhoa { get; set; }
        public string Ngayvaolam { get; set; }
        public string HocVi { get; set; }
        public string HocHam { get; set; }
        #endregion

        #region Hàm
        public DataTable LayThongTinGiaoVien()
        {
            string sql = "SELECT *  FROM LYLICH";
            return _myConnect.GetDataTable(sql);
        }

        public void ThemThongTinGiaoVien()
        {
            string sql = "INSERT INTO GIAOVIEN VALUES ('" + MaGV + "','" + Ho + "','" + Ten + "','" + 
                HocVi + "', '" + HocHam + "', '" + GioiTinh + "','" + NgaySinh + "','" + NoiSinh + "','" +
                Ngayvaolam + "','" + MaKhoa + "')";
            _myConnect.ExecuteNonquery(sql);

        }
        public void UpdateThongTinGiaoVien()
        {
            string sql = "UPDATE GIAOVIEN SET Ho = '" + Ho + "', Ten = '" + Ten + "', Hocvi = '" + HocVi + "', Hocham = '" +
                HocHam + "', GioiTinh = '" + GioiTinh + "', Ngaysinh = '" + NgaySinh + "', Noisinh = '" + NoiSinh  + "', Ngayvaolam = '" +
                Ngayvaolam + "',MaKhoa = '"+MaKhoa  +"' WHERE MAGIAOVIEN = '" + MaGV + "'";
            _myConnect.ExecuteNonquery(sql);
        }
        public void DeleteThongTinGiaoVien()
        {
            string sql = "DELETE FROM GIAOVIEN WHERE MAGIAOVIEN = '" + MaGV + "'";
            _myConnect.ExecuteNonquery(sql);
        }
        #endregion
    }
}
